
<%@ include file="/common/taglibs.jsp"%>
<!--分页查询共用的页面-->
<%@ include file="/common/common.jsp"%>
<%@ page language="java" pageEncoding="UTF-8"%>

<style>
html { overflow-x:hidden; }
</style>

<script type="text/javascript" src="<%=jsPath%>/jquery/jquery.timers.js"></script><!--定时器-->
<script>

    function newAlarmConfig()
    {
        InfoWindow.editAlarmConfig(0);
    }


$().ready(function() {
	

	 $("#cbCheckAllAlarm").click(function() {
                $('input[name="alarmEnable"]').attr("checked",this.checked);
				//$(".paramInput").attr("disabled", this.checked == false);
      });
	   $("#cbCheckAllSound").click(function() {
                $('input[name="alarmSoundEnable"]').attr("checked",this.checked);
      });

	   $("#cbCheckAllPopup").click(function() {
                $('input[name="alarmPopupEnable"]').attr("checked",this.checked);
      });
	    $("#cbCheckAllStatistic").click(function() {
                $('input[name="alarmStatisticEnable"]').attr("checked",this.checked);
      });
	   $("#btnCreate").click(function() {
		   $(".dataRow").show();
		   
		  $("#btnCreate").hide();
		  $("#btnTips").hide();
		  
		   $("#btnModify").show();
		   $("#btnDelete").show();
		  $("#tips").hide();
      });

	   $("#btnDelete").click(function() {
		   //location.href="<%=ApplicationPath%>/alarmConfig/delete.action?depId="+${depId};
      });



	  var isNew = false;// ${isNew};

	  if(isNew)
	 {
		  $("#btnCreate").show();
		  $("#tips").show();
		   $(".dataRow").hide();
		   $("#btnModify").hide();
		   $("#btnDelete").hide();
	  }else
	 {
		  $("#btnCreate").hide();
		  $("#tips").hide();
		  
		   $("#btnModify").show();
		   $("#btnDelete").show();
	  }

});
</script>
 <BODY>
	<form id="entityForm" name="entityForm" 
			action='<%=ApplicationPath%>/alarmConfig/config.action' method="POST">
			<!--所属部门Id-->
        <input type="hidden"  name="depId"  id="depId" value="0"/>
        <input type="hidden"  name="isNew"  id="isNew" value="false"/>
  <table width="99%"  class="TableBlock">
					<tbody><tr>
						<td colspan="8" style="font-weight: bold; background: #EFEFEF;" height="25">${depName}-报警设置
						<span class="MessageFromServer">${message}</span>


							<button id="btnModify" type="submit" class="button green medium" ><i class="fa fa-check" style="margin-right:3px;"></i> 保存报警设置</button>

							<button id="btnNew" type="button" class="button blue medium" onclick="newAlarmConfig();"><i class="fa fa-plus"  style="margin-right:3px;"></i> 创建报警设置</button>

						</td>
					</tr>
					<tr class="TableHeader dataRow">
                          <TD>报警代码</TD>
                          <TD>报警类型</TD>
                          <TD>报警来源</TD>
						  <TD><input type="checkbox" id="cbCheckAllAlarm" />启用报警 </TD>		
						  <TD><input type="checkbox" id="cbCheckAllSound" />报警声音 </TD>	
						  <TD><input type="checkbox" id="cbCheckAllPopup" />报警弹窗 </TD>	
						  <TD><input type="checkbox" id="cbCheckAllStatistic" />启动统计报警时间 </TD>
						<TD>报警联动通道 </TD>
					</tr>
					  <c:forEach items="${alarmConfigs}" var="alarmConfig" >
					<tr class="dataRow">
					  <td >
						  ${alarmConfig.alarmType}
						</td>
						<td >
							<a href="javascript:InfoWindow.editAlarmConfig(${alarmConfig.entityId});">
									${alarmConfig.name}
							</a>
						</td>
						<td >
						  ${alarmConfig.alarmSource}
						</td>
										
						<td > 
						      <input type="checkbox" id="alarmConfig_${alarmConfig.entityId}" name="alarmEnable" value="${alarmConfig.entityId}"
									<c:if test="${alarmConfig.enabled==true}">
								   checked
								</c:if>	
							  />
						</td>
											
						<td >
						       <input type="checkbox" id="alarmConfig_${alarmConfig.entityId}" name="alarmSoundEnable" value="${alarmConfig.entityId}" 
								 <c:if test="${alarmConfig.soundEnabled==true}">
									  checked
								</c:if>	
							  />
						</td>				
						<td >
						
						       <input type="checkbox" id="alarmConfig_${alarmConfig.entityId}" name="alarmPopupEnable" value="${alarmConfig.entityId}" 
								 <c:if test="${alarmConfig.popupEnabled==true}">
									  checked
								</c:if>		
							   />
						</td>
						<td >
						  
						       <input type="checkbox" id="alarmConfig_${alarmConfig.entityId}" name="alarmStatisticEnable" value="${alarmConfig.entityId}"
								 <c:if test="${alarmConfig.statisticEnabled==true}">
									 checked
								</c:if>		
									   />
						</td>
						<td>
								${alarmConfig.videoMonitorChannels}
						</td>
						
						<!--
						<td>
						  <image src="<%=ApplicationPath%>/image/accept.gif" style="cursor:hand"
						  onclick=""></image>
						</td>
						-->
					</tr>
					</c:forEach>  

				
					
				</tbody></table>
		</form>
 </BODY>
</HTML>
